﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace DevelopTools.UI
{
    public class UIStateControl : MonoBehaviour
    {
        public enum StateCarR
        {
            RotateObject,
            MouseDown,
            RotateObjByMouse,
            Normal,
            ShowUI,
            ShowPuyi,
        }
        public StateCarR mStateCarr;
        public GameObject allObj;

        public GameObject rightButton, leftButton, carrUIObj, changeLanguage;
        public static UIStateControl instance;

        public GameObject duibentiObj;
        public GameObject othersObj;
        void Awake()
        {
            instance = this;
        }
        // Use this for initialization
        void Start()
        {

        }
        public float timeNow;
        // Update is called once per frame
        void Update()
        {
            switch (mStateCarr)
            {
                case StateCarR.MouseDown:
                    {

                    }
                    break;
                case StateCarR.RotateObjByMouse:
                    {
                        if (ClickMoveControl.instance.RotReady() == false
                              || ClickMovePuYiControl.instance.RotReady() == false || InputControl.instance.isMouseUp)
                        {
                            mStateCarr = StateCarR.Normal;
                        }
                    }
                    break;
                case StateCarR.RotateObject:
                    {

                    }
                    break;
                case StateCarR.Normal:
                    {
                        if (ClickMoveControl.instance.RotReady() && ClickMovePuYiControl.instance.RotReady())
                        {
                            mStateCarr = StateCarR.RotateObject;
                            rightButton.SetActive(true);
                            leftButton.SetActive(true);
                            carrUIObj.SetActive(true);
                        }
                        else
                        {
                            rightButton.SetActive(false);
                            leftButton.SetActive(false);
                        }
                    }
                    break;
                case StateCarR.ShowUI:
                    {
                        rightButton.SetActive(false);
                        leftButton.SetActive(false);
                    }
                    break;
            }

            //if (ClickMoveControl.instance.RotReady() && ClickMovePuYiControl.instance.RotReady())
            //{            
            //    rightButton.SetActive(true);
            //    leftButton.SetActive(true);
            //}else
            //{
            //    rightButton.SetActive(false);
            //    leftButton.SetActive(false);
            //}

        }

        public void SetTimeNow(float timeNowNum)
        {
            timeNow = timeNowNum + Time.time;

        }


        public void SetObjActive(bool show)
        {
            allObj.SetActive(show);
        }

        public void SetOtherObjActive(bool show)
        {
            othersObj.SetActive(show);
        }
    }
}